package ProjetCorba;

/**
 * Interface definition : Casier
 * 
 * @author OpenORB Compiler
 */
public class _CasierStub extends org.omg.CORBA.portable.ObjectImpl
        implements Casier
{
    static final String[] _ids_list =
    {
        "IDL:ProjetCorba/Casier:1.0"
    };

    public String[] _ids()
    {
     return _ids_list;
    }

    private final static Class _opsClass = ProjetCorba.CasierOperations.class;

    /**
     * Operation estVide
     */
    public boolean estVide()
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("estVide",true);
                    _input = this._invoke(_output);
                    boolean _arg_ret = _input.read_boolean();
                    return _arg_ret;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("estVide",_opsClass);
                if (_so == null)
                   continue;
                ProjetCorba.CasierOperations _self = (ProjetCorba.CasierOperations) _so.servant;
                try
                {
                    return _self.estVide();
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Operation getCasier
     */
    public ProjetCorba.Casier getCasier(short idCas)
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("getCasier",true);
                    _output.write_short(idCas);
                    _input = this._invoke(_output);
                    ProjetCorba.Casier _arg_ret = ProjetCorba.CasierHelper.read(_input);
                    return _arg_ret;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("getCasier",_opsClass);
                if (_so == null)
                   continue;
                ProjetCorba.CasierOperations _self = (ProjetCorba.CasierOperations) _so.servant;
                try
                {
                    return _self.getCasier( idCas);
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Operation getColis
     */
    public ProjetCorba.Colis getColis(short idCol)
        throws ProjetCorba.Col_Inconnu
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("getColis",true);
                    _output.write_short(idCol);
                    _input = this._invoke(_output);
                    ProjetCorba.Colis _arg_ret = ProjetCorba.ColisHelper.read(_input);
                    return _arg_ret;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    if (_exception_id.equals(ProjetCorba.Col_InconnuHelper.id()))
                    {
                        throw ProjetCorba.Col_InconnuHelper.read(_exception.getInputStream());
                    }

                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("getColis",_opsClass);
                if (_so == null)
                   continue;
                ProjetCorba.CasierOperations _self = (ProjetCorba.CasierOperations) _so.servant;
                try
                {
                    return _self.getColis( idCol);
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

}
